package src.com.atguigu03._throws;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * @author BuTang
 * @create 15:24
 */
public class ThrowsTest {
    public static void main(String[] args) {
        try {
            method2();
        }catch (FileNotFoundException e ){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }

    }

    public static void method3() throws FileNotFoundException, IOException {
        method2();
    }


    public static void method2() throws FileNotFoundException, IOException {

    }


    public static void method1() throws FileNotFoundException, IOException {
        File file = new File("D:\\hello.txt");

        FileInputStream fis = new FileInputStream(file); //可能报FileNotFoundException

        int data = fis.read(); //可能报IOException
        while (data != -1) {
            System.out.print((char) data);
            data = fis.read(); //可能报IOException
        }

        fis.close(); //可能报IOException
    }
}

